package com.xiaoma.thread.exceptionhandler;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 捕获子线程异常
 */
public class MainTest {
    public static void main(String[] args){
            ExecutorService exe = Executors.newCachedThreadPool(new HandlerThreadFactory());//使用我们自定义的ThreadFactory


        for (int i = 0; i < 100; i++) {
            final int cur = i;
            exe.execute(new Runnable() {
                @Override
                public void run() {
                    if (cur < 40)
                    {
                        return;
                    }
                    else
                    {
                        Integer.parseInt("abc");
                    }

                }
            });
        }
    }
}
